Domain Modeling Made Functional: Tackle Software Complexity with Domain-Driven Design and F#

Domain Modeling Made Functional: Tackle Software Complexity with Domain-Driven Design and F#

  • Downloads:9367
  • Type:Epub+TxT+PDF+Mobi
  • Create Date:2021-10-29 09:54:36
  • Update Date:2025-09-06
  • Status:finish
  • Author:Scott Wlaschin
  • ISBN:1680502549
  • Environment:PC/Android/iPhone/iPad/Kindle

Summary

You want increased customer satisfaction, faster development cycles, and less wasted work。 Domain-driven design (DDD) combined with functional programming is the innovative combo that will get you there。 In this pragmatic, down-to-earth guide, you'll see how applying the core principles of functional programming can result in software designs that model real-world requirements both elegantly and concisely - often more so than an object-oriented approach。 Practical examples in the open-source F# functional language, and examples from familiar business domains, show you how to apply these techniques to build software that is business-focused, flexible, and high quality。

Domain-driven design is a well-established approach to designing software that ensures that domain experts and developers work together effectively to create high-quality software。 This book is the first to combine DDD with techniques from statically typed functional programming。 This book is perfect for newcomers to DDD or functional programming - all the techniques you need will be introduced and explained。

Model a complex domain accurately using the F# type system, creating compilable code that is also readable documentation---ensuring that the code and design never get out of sync。 Encode business rules in the design so that you have "compile-time unit tests," and eliminate many potential bugs by making illegal states unrepresentable。 Assemble a series of small, testable functions into a complete use case, and compose these individual scenarios into a large-scale design。 Discover why the combination of functional programming and DDD leads naturally to service-oriented and hexagonal architectures。 Finally, create a functional domain model that works with traditional databases, NoSQL, and event stores, and safely expose your domain via a website or API。

Solve real problems by focusing on real-world requirements for your software。

What You Need:

The code in this book is designed to be run interactively on Windows, Mac and Linux。You will need a recent version of F# (4。0 or greater), and the appropriate 。NET runtime for your platform。Full installation instructions for all platforms at fsharp。org。

Download

Reviews

Nick

Two for the price of oneA well written and well thought out book where you can learn two things at once without feeling overwhelmed or either feeling watered down, although it leans a bit more towards FP than DDD。 You won't become an expert in either but you'll definitely have a good theoretical grounding at the end。The book uses a fictitious case study that, while being necessarily simple, is still complex and believable enough to serve its purpose。 It also doesn't oversell DDD as a silver bull Two for the price of oneA well written and well thought out book where you can learn two things at once without feeling overwhelmed or either feeling watered down, although it leans a bit more towards FP than DDD。 You won't become an expert in either but you'll definitely have a good theoretical grounding at the end。The book uses a fictitious case study that, while being necessarily simple, is still complex and believable enough to serve its purpose。 It also doesn't oversell DDD as a silver bullet/panacea which I appreciated - the rough edges and tradeoffs of the approach (especially when using an explicit FP language) are openly noted。The only negative I have is that while most fundamental F# concepts and syntax are explained quite thoroughly in the first two thirds of the book, in the last third they're suddenly glossed over as if you've magically gone off and learned a whole bunch of things on your own。 This is jarring and a bit annoying but overall a minor issue。 Highly recommended。 。。。more

Júlia Birkett

It's really impressive how Domain-Driven Design matches Functional Programming, especially with a typed language as F#。 I used to think that DDD made more sense to be applied with OOP, but now I think the opposite。 The book is super easy to read。 It contains lots of practical examples using different workflows of a hypothetical (but realistic) domain。 It gives you a good sense of how it would be to apply DDD in a real application by covering use cases from the user input until storing them in a It's really impressive how Domain-Driven Design matches Functional Programming, especially with a typed language as F#。 I used to think that DDD made more sense to be applied with OOP, but now I think the opposite。 The book is super easy to read。 It contains lots of practical examples using different workflows of a hypothetical (but realistic) domain。 It gives you a good sense of how it would be to apply DDD in a real application by covering use cases from the user input until storing them in a database。One of my favourites about DDD! 。。。more

lojislav

Similar to others, I would note that if you have a background in Modeling or a background in F#, nothing herein will be surprising。 However, the presentation of the material and the direction was excellent。 I do wish there were more explicit exercises for many things, but I will be recommending this book to everyone that I teach to do threat modeling。

Kevin Roche

Good high level guide to DDD using the functional programming paradigmThe functional programming paradigm is an excellent match for Domain driven development and this book provides a helpful walkthrough of some of the specific techniques that can be applied to the practice。The opening chapters give a high level grounding in DDD concepts (Event storming, Bounded contexts, Ubiquitous language, etc。) and the following chapters take a deeper dive into implementing them using a functional approach。F# Good high level guide to DDD using the functional programming paradigmThe functional programming paradigm is an excellent match for Domain driven development and this book provides a helpful walkthrough of some of the specific techniques that can be applied to the practice。The opening chapters give a high level grounding in DDD concepts (Event storming, Bounded contexts, Ubiquitous language, etc。) and the following chapters take a deeper dive into implementing them using a functional approach。F# is the author's language of choice and we get to see how flexible it can be in modelling business domain requirements。Neither a thorough guide to DDD nor F# this book nevertheless plays an essential role in demonstrating the utility of the functional programming paradigm to DDD。 。。。more

Mantas

It's more about functional programing, than about domain modeling。 But still, nice intro into both areas。 It's more about functional programing, than about domain modeling。 But still, nice intro into both areas。 。。。more

Manh Tai

You don’t need to know F# beforehand to read the book。 A good read about DDD and FP。

Micah

A solid introduction to functional programming, but not without flawsIn this book, Scott Wlaschin walks us through an imaginary software design project and demonstrates how we can apply functional programming paradigms, as well as the particular capabilities of the F# programming language, to tackling large application development through domain-driven design (DDD)。Some highlights of the book that felt particularly important to me:* Wlaschin lays out the fundamentals of Domain-Driven Development A solid introduction to functional programming, but not without flawsIn this book, Scott Wlaschin walks us through an imaginary software design project and demonstrates how we can apply functional programming paradigms, as well as the particular capabilities of the F# programming language, to tackling large application development through domain-driven design (DDD)。Some highlights of the book that felt particularly important to me:* Wlaschin lays out the fundamentals of Domain-Driven Development, including:- Domains: Areas of knowledge associate with a problem (e。g。, "Billing", "Shipping", or "Intake")- Domain Model: Simplifications that represent a domain to stakeholders- The Ubiquitous Language: A set of concepts and vocabulary associated with the domain and shared by both team members and the source code- Bounded Context: A subsection in the solution space with clear boundaries from other subsystems。 Subsystems have their own concepts and vocabulary - dialects of the Ubiquitous Language。- Events: Records of something that has happened in the system- Commands: A request for something to happen, triggered by a person or event。 * We learn about how events and commands can be used to connect different bounded contexts, allowing them to work together harmoniously while remaining fundamentally decoupled。Key points here were that each of our bounded contexts need to be able to receive Data Transfer Objects (DTOs), picking up where other bounded contexts have left off。 DTOs are received and pass through input and output gates, for validation/sanitization and serialization, respectively。 Everything inside the bounded context can be trusted, everything outside must be treated with care - assume nothing, and we avoid much unnecessary coupling。* Wlaschin introduces the idea of Onion ArchitectureThe basic concept here is that you keep your domain code stateless and pure, while positioning Async/IO processes (APIs, etc。) on the edges。 How well this pattern holds up in practice is debatable, but it is a good ideal。* We learn about a variety of functional programming patterns, and their application in F#I won't go too deep here, but did learn a lot about a maximalist functional approach to building pipelines and adapting functions to be able interlink with other functions in the pipeline and pass on their errors as necessary。I ultimately thought that pipelines are very cool when feasible, but was not convinced that some of the gymnastics that Wlaschin had us go through to achieve clean pipelines were necessarily worth it, or sufficiently maintainable to justify the overhead。* Wlaschin argues - quite successfully - that types can largely replace documentationOne very powerful idea in this book, and demonstrated in F#, is that code can be demonstrably correct。 Throughout the book, Wlaschin emphasizes patterns that make it literally impossible to introduce certain errors。 Practiced with discipline, this style of coding could eliminate the need for some classes of tests。Summing up:I felt like the book got weaker as it went along, both because Wlaschin tried to accomplish too much in too short a book, often hand-waving advanced concepts, while perhaps spending too much time on trivial concepts and code examples。I also felt like F# was both the strength and Achilles heel of this book。 Because Wlaschin spent so much time evangelizing the special abilities of F#, it was at times hard to translate the techniques he demonstrated into other, less-functionally-oriented languages (like Javascript/Typescript, for example)。Overall, this was a solid book that I would recommend for folks who are interested in going deeper in the functional programming paradigm。 And the Domain-Driven Development model was useful for understanding the thinking behind the Redux state management framework that is very popular for front-end applications。Still, the book has some weaknesses of spotty depth and sort of peters out towards the end。 。。。more

Nuno Caro

It is a very practical approach to DDD and why leveraging the type system is very important。I didn't consider the F# details as interesting as the rest of the book but still it explains how functional programming concepts help dealing with complexity。 It is a very practical approach to DDD and why leveraging the type system is very important。I didn't consider the F# details as interesting as the rest of the book but still it explains how functional programming concepts help dealing with complexity。 。。。more

Adrian Bercovici

This review has been hidden because it contains spoilers。 To view it, click here。 In just a mere 260 pages Scott does a terrific job implementing a real life order processing system in a DDD way starting from requirements gathering , implementation and even further development , explaining along the way DDD concepts (domains, bounded contexts , adapters, side effects) as well as functional programming with F# (including functors , applicatives , monads ) 。While the code snippets and the explanations are great what makes this book shine are the drawings !Never have i seen so m In just a mere 260 pages Scott does a terrific job implementing a real life order processing system in a DDD way starting from requirements gathering , implementation and even further development , explaining along the way DDD concepts (domains, bounded contexts , adapters, side effects) as well as functional programming with F# (including functors , applicatives , monads ) 。While the code snippets and the explanations are great what makes this book shine are the drawings !Never have i seen so many abstract concepts that are usually hard to grasp so intuitively depicted and explained as in this book !Must read for anyone interested in DDD , functional programming , Fsharp and designing better and bug-free systems in general ! 。。。more

Andrey

Read my blogpost https://shumeev。medium。com/book-revie。。。 Read my blogpost https://shumeev。medium。com/book-revie。。。 。。。more

Rubén

Un libro muy interesante para entender DDD sin toda la palabrería que meten en otros libros。 Directo y al grano。 La parte funcional también está muy bien, aunque es más difícil sacarle partido si usas otros lenguajes funcionales de tipado dinámico。

Keith Nicholas

Maybe the book was over hyped by various people, but I found the book disappointing。 The discussion on DDD was pretty good, The discussion around types and algebraic types for modelling the domain is pretty good, but the actual F# didn't seem that good and a lot of the design choices seemed very rigid。 If you have a reasonable understanding of functional programming, you can download the code for the book off the prag prog website and check it out for yourself。 Luckily I got this book through th Maybe the book was over hyped by various people, but I found the book disappointing。 The discussion on DDD was pretty good, The discussion around types and algebraic types for modelling the domain is pretty good, but the actual F# didn't seem that good and a lot of the design choices seemed very rigid。 If you have a reasonable understanding of functional programming, you can download the code for the book off the prag prog website and check it out for yourself。 Luckily I got this book through the local library so I didn't lose any money on it。 。。。more

Marcos C。 Santos

It's a good reading for people interested on learning about Domain Driven Design using real world business applications。 Really well written book, its first two parts are extremely beginner friendly, but the last (and most important part) not as much。 The last section of the book assumes you're already familiar with some of F# syntax and constructors, although, one can easily follow up the book until it's end without knowing it。Sometimes I felt like it missed showing up the entire view of the pr It's a good reading for people interested on learning about Domain Driven Design using real world business applications。 Really well written book, its first two parts are extremely beginner friendly, but the last (and most important part) not as much。 The last section of the book assumes you're already familiar with some of F# syntax and constructors, although, one can easily follow up the book until it's end without knowing it。Sometimes I felt like it missed showing up the entire view of the project and keeping the reader updated about it, and the Functional Error Handling and Pipeline with functions chapters could benefit from more space in the book, as some others previous chapters have。It's an amazing software development book, and a good guide for people who wants insights on how to create and maintaining a real world application using F#。 。。。more

Pepijn Looije

Even without exposure to F#, the code examples are easy to follow。 Trivially translatable to Scala, and even to Clojure with a bit of imagination。 I constantly refer to this book on my day job (at a big fintech company)。

Patryk Woziński

It was amazing! The best book that covers Domain-Driven and domain modeling topics I’ve ever read。

Yura Zdyrko

Useful book, even to programmers who don't use F# (Elixir in my case)。I understand domain modelling much better now。 Useful book, even to programmers who don't use F# (Elixir in my case)。I understand domain modelling much better now。 。。。more

Jonathan Stiansen

I think it was clear, solid, and well thought out。 I learned a model of organizing software architecture, using types as state machines, and allowing them to be driven from your domain and those types driving your computation。

Damian Zydek

This book teaches by an example。 The author took an examplary project done with a functional programming approach and described three phrases from it (Analysis, Design, Implementation)。 Part I - Analysis - Discovering Domain (general knowledge)。For me, it is the best chapter of all。 The author starts with the event storming session for discovering events, commands, and subdomains in problem space。 After this, he creates a solution space with bounded contexts and relationships within them (contex This book teaches by an example。 The author took an examplary project done with a functional programming approach and described three phrases from it (Analysis, Design, Implementation)。 Part I - Analysis - Discovering Domain (general knowledge)。For me, it is the best chapter of all。 The author starts with the event storming session for discovering events, commands, and subdomains in problem space。 After this, he creates a solution space with bounded contexts and relationships within them (context map)。Part II - Design - Designing the Domain Model (with F# types)。It is a great introduction to functional thinking - the reason why I read this book。Part III - Implementation - Implementing the Domain Model (with F#)It describes the most common implementation decisions in F# approaches (object persistence, error handling, managing dependencies, testing, etc。)。 If you are not planning to use functional programming, you can skim this part。 。。。more

Ian Tuomi

I got a lot out of the first half of the book where the essence of ddd is distilled very cleanly from a functional point of view。 I consider many of these viewpoints as close to canon as it gets in software development。 Outstanding 5/5The second half was a mix of strict functional programming strategies like making pure pipelines by composing meticulously typed function inputs and outputs to match each other (I am not a fan of this approach。 While satisfying and beautiful, I find it difficult to I got a lot out of the first half of the book where the essence of ddd is distilled very cleanly from a functional point of view。 I consider many of these viewpoints as close to canon as it gets in software development。 Outstanding 5/5The second half was a mix of strict functional programming strategies like making pure pipelines by composing meticulously typed function inputs and outputs to match each other (I am not a fan of this approach。 While satisfying and beautiful, I find it difficult to read, write, and refactor in practice, with no clear benefit。 Perhaps I will “see the light” some day :) ) and F# -specific implementation details like serializing Json。 There were some gems here and there, but i found myself skimming。 I should note that this may be due to me picking up a F# book as a non-F# programmer。All in all, this is one of the more important books I have read about programming, and recommend just about everyone working on anything related to software to read the first half。 Call it “DDD: The Good Parts” 。。。more

Aaron Cruz

Really fantastic book。 It has made me completely change some fundamental ways I design software。The book uses F# in the design implementations, a language that I have never used, though I have some years of functional programming experience。 It isn't an intro to F# but either because of its simplicity or the author's incredible teaching ability, everything makes sense。 You don't need any background in the language。I really can't say enough good things about this book。 Highly recommended。 Really fantastic book。 It has made me completely change some fundamental ways I design software。The book uses F# in the design implementations, a language that I have never used, though I have some years of functional programming experience。 It isn't an intro to F# but either because of its simplicity or the author's incredible teaching ability, everything makes sense。 You don't need any background in the language。I really can't say enough good things about this book。 Highly recommended。 。。。more

arun

This book walks you through the key concepts of Domain Driven Design in a practical and easy to grok manner。 Examples are well crafted and do not require expertise of F# (I read it with a little knowledge of a similar language, Kotlin)。 It helped me learn the "why" behind functional patterns。The journey starts with identifying the Vocabulary for a Domain (ubiquitous language) using Event Storming。 Next modeling with Types is covered。 Workflows are represented with Functions along with the Types。 This book walks you through the key concepts of Domain Driven Design in a practical and easy to grok manner。 Examples are well crafted and do not require expertise of F# (I read it with a little knowledge of a similar language, Kotlin)。 It helped me learn the "why" behind functional patterns。The journey starts with identifying the Vocabulary for a Domain (ubiquitous language) using Event Storming。 Next modeling with Types is covered。 Workflows are represented with Functions along with the Types。 Second part covers implementation strategies - dependency injection, handling effects with railway oriented programming and so on。 。。。more

Gregor Riegler

This Book explains the thought process of Software Design using the Functional Paradigm very well。It's not about the language F#, it's about the paradigm。 I do not use F#, nor am i'm planning to。 Still, the book had a lot of value to me。A key learning is how to take advantage of Types to achieve a better Domain Model。For me, a OO Guy digging into FP, it was a mind opener。 It teached me how to think in workflows, how to compose and streamline testable functions, how to inject dependencies using p This Book explains the thought process of Software Design using the Functional Paradigm very well。It's not about the language F#, it's about the paradigm。 I do not use F#, nor am i'm planning to。 Still, the book had a lot of value to me。A key learning is how to take advantage of Types to achieve a better Domain Model。For me, a OO Guy digging into FP, it was a mind opener。 It teached me how to think in workflows, how to compose and streamline testable functions, how to inject dependencies using partial application, and how to achieve a great result even without using a single monad。Great Book。 。。。more

Daniel Wellner

This book was not for me, I guess。 Being familiar with OO -based DDD, but an F# newbie, I was hoping to learn a lot about domain modeling in F# and FP。 While I learned a lot about FP and F# in general, I felt the book bid not live up to the domain bit of the title。 I was also disappointed that event sourcing was not covered in this book at all。

Johan Oelrich

The book gives an example of how to create a larger system using functional programming and DDD。 The focus is heavily on solving the problem and communicating the solution to non-programmers。 I found it a really good introduction to DDD and thinking about system design。

Dracanus

I struggle to read technical books (I'm working on it) and this took me a while to get through。 I'll definitely be reading it again because it has a lot of information on offer。You don't need to know F# to read this, the concepts used are explained really well。 I struggle to read technical books (I'm working on it) and this took me a while to get through。 I'll definitely be reading it again because it has a lot of information on offer。You don't need to know F# to read this, the concepts used are explained really well。 。。。more

Darius

I wish I had this book 5 years ago when functional paradigm and F# became part of what I do。 Even though we are all introduced to functional principles in school (without calling it functional, we just called it math) and later (I'm sure some even earlier) in Excel, it is not easy to isolate the afterwards acquired procedural and object oriented thinking。 At that moment one has to reserve an innocent place in one's brain to fully embrace the functional paradigm without carrying the old habits al I wish I had this book 5 years ago when functional paradigm and F# became part of what I do。 Even though we are all introduced to functional principles in school (without calling it functional, we just called it math) and later (I'm sure some even earlier) in Excel, it is not easy to isolate the afterwards acquired procedural and object oriented thinking。 At that moment one has to reserve an innocent place in one's brain to fully embrace the functional paradigm without carrying the old habits along。If I was reading this book then, with my mind as open as I now recommend to others, not only I would be impressed, I would be put on a good path right away。 I would say that this book may be a good entry point to DDD as the context is practical and the F# type system is very fitting for the job。Be aware that the content of this book may influence your take on thinking about systems, modelling, designing your applications and that may lead to some friction with other fellow developers that may lack the context you just gained。The book deserves more in terms of formatting。 E。g。 pictures and tables should have titles, descriptions。 The Pragmatic Programmers series suffers in that regard in general, but the contents compensated for that well enough。 。。。more

Yannick Grenzinger

Surely one of the best book how to implement the tactical part of DDD in a functional way。 Totally practical, avoiding Category Theory, and giving a lot of knowledge about how tu use functional programming and types to implement a very robust domain。

Marcin Golenia

I have been having a feeling that DDD and OO aren't always the best match。 Especially in domains when we are interested in transitions between types and states (so plenty of them)。 I am more than glad that this book has come to live。 I already had some knowledge about DDD in F# thanks to Scott talks at conferences and fsharpforfunandprofit but this books makes this complete。 The code examples are very good, easy to understand, and easy to follow。 I really appreciate how the book is organised; DD I have been having a feeling that DDD and OO aren't always the best match。 Especially in domains when we are interested in transitions between types and states (so plenty of them)。 I am more than glad that this book has come to live。 I already had some knowledge about DDD in F# thanks to Scott talks at conferences and fsharpforfunandprofit but this books makes this complete。 The code examples are very good, easy to understand, and easy to follow。 I really appreciate how the book is organised; DDD Recap, tips for functional programming and OO comparison, introduction to types, actual modeling, and finally implementation。 In the end, Scott also helps to work with IO - Dtos, databases, json。 Strongly recommended read。 。。。more

Joan Valduvieco

Good book to introduce yourself to DDD and a bit into functional programming。 Missing a chapter about testing。

Ferdinando Santacroce

A great book, liked it。A very good distillation of DDD, an interesting picture of F# and it's powerful Type System, and some Functional concepts and wisdom。Don't buy it if you want to learn FP。 It's not a book that wants to tech you one particular argument (DDD, FP, F#), but "only" a demonstration of how the "three amigos" can play well together。 A great book, liked it。A very good distillation of DDD, an interesting picture of F# and it's powerful Type System, and some Functional concepts and wisdom。Don't buy it if you want to learn FP。 It's not a book that wants to tech you one particular argument (DDD, FP, F#), but "only" a demonstration of how the "three amigos" can play well together。 。。。more